## -------------------------------------------------- #
## BuenoNunesZucco_JoP_README
## -------------------------------------------------- #

 Date: 2021-09-23

 Authors: Natália S. Bueno, Felipe Nunes, and Cesar Zucco

 Title: Making the bourgeoisie? Values, voice, and state-provided homeownership
 
Contact Information: 
   Natália S. Bueno <natalia.bueno@emory.edu>
   Felipe Nunes <felipnunes@gmail.com>
   Cesar Zucco <cesar.zucco@fgv.br>
   
	
 Copyright (c) 2021, under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
 For more information see: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
 All rights reserved. 



## -------------------------------------------------- #

This file describes the contents of the replication archive used to conduct the analyses in the main text and appendix. 


## -------------------------------------------------- #
## install R and necessary packages for analysis
## -------------------------------------------------- #

install R 

install packages if necessary. See file packages.html in Code folder for information on package versions and session info.

save the replication files locally, preserving the folder structure in the replication materials. The replication code code assumes a certain folder (directory) structure. As long as the folders are in the R working directory the script will find these files and work properly. 

open the .R files using RStudio or any text or source code editor 

set the working directory to the folder containing the data files 
	the set working directory command in R is setwd()
	to set the path type into R: setwd("PATH_NAME"), where PATH_NAME is the path to the main folder
	type ?setwd for help documentation 

Check the R working directory is available via the getwd() function in R.

Run the replication files, one at a time, following their numbers at the start of the file names, beginning with number 1 and ending with number 4. 


## -------------------------------------------------- #
## hardware and software 
## -------------------------------------------------- #

The last version of R and Mac OS-X at the time the paper was published are:

	R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
	Copyright (C) 2020 The R Foundation for Statistical Computing
	Platform: x86_64-apple-darwin15.6.0 (64-bit)

All models were estimated on a iMac (21.5-inch, 2017), running macOS Catalina (10.15.7).


## -------------------------------------------------- #
# file folder descriptions
## -------------------------------------------------- #
 
Codebooks.pdf --- Codebook describing all variables in the datasets used in the analysis of the manuscript and appendix


code ---- folder containing the following script files:

	packages.html: 
		html file with information on session and package version
		Make sure all packages listed in this file are installed
	functions.R: 
		R file with functions used in creating data, main paper and appendix. 
		These functions are called from the other routines
	_creating_data_W1_public.R: 
		R file that creates the dataset used in the W1 analyses. 
		This script is not replicable because it uses the raw data with identifiable information which not shared
		It produces the anonymized datasets that are the starting point for the replication. 
        _creating_data_W2_public.R: 
		R file that creates the dataset used in the W2 analyses. 
		This script is not replicable because it uses the raw data with identifiable information which not shared
		It produces the anonymized datasets that are the starting point for the replication. 
	1_analysis_W1.R: 
		R file that recodes W1 data and estimates for W1 analysis
		Requires the dataset produced by _creating_data_W1_public.R
	2_analysis_W2.R: 
		R file that recodes W2 data and estimates for W2 analysis
		Requires the dataset produced by _creating_data_W2_public.R
        3_analysis_WW.R: 
		R file that recodes data and estimates for analysis combines data from W1 and W2
		Should be ran after the previous routines
	4_analysis_outputs: 
		R file that produces tables, figures, and data cited in main paper and in online appendix
		Should be run after the previous routines


Figures --- folder contains all figures as eps files

	All figures are provided, but can be re-generated by running the code, above

HTMLLogs --- folder contains logs of the output of the replication files (files 1-4) 

Tables --- folder contains all table outputs as tex files

	All tables are provided, but can be re-generated by running the code, above

Questionnaires-InterviewScripts: Questionnaires and Interview Scripts in Portuguese

Routputs --- folder contains estimates from analyses to be used in the Figures and Tables in the main paper and online appendix

    These files are generated by running .R file 1-4, above, with the exceptions of these two files:

	out-a1.RData
	out-inscritosearlylate.RData

    These two files require identified data in order to be produced so they cannot be produced with the code provided. For transparency, we left the original code that produced these files in the .R code (as comments), but we provide the pre-assembled object instead
 

Data --- folder containing the datasets used in the main analysis and in the appendix; see Codebooks.pdf for a description of the datasets. The datasets were originally created by   _creating_data_W1_public.R and _creating_data_W2_public.R, but  these required identified individual information that cannot be publicly shared. We therefore provide the code to create the files, but not the identified data. We provide, instead, these files with de-identified data.
	SurveyW1-Making.RData
	SurveyW2-Making.Rda
	W1_attrition_overall_public.Rda
	W1_attrition_public.Rda
	W2_attrition_overall_public.Rda
	W2_attrition_public.Rda
	W2_attrition_admin_overall_public.Rda



## -------------------------------------------------- #
# additional notes 
## -------------------------------------------------- #

We do not provide the raw datasets containing private individual identifiers. 
Our scripts on creating the datasets (i.e. those files whose names begin with _) show our data manipulations, but the raw datasets are not available due to personal identifiable information.



## -------------------------------------------------- #
## end of file
## -------------------------------------------------- #

